package com.chencs.biz.model.service;

import com.chencs.biz.category.service.CategoryService;
import com.chencs.vo.biz.model.ModeBlockModel;
import com.chencs.vo.biz.model.ModeModel;
import com.chencs.webmvc.rest.RestFullTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by fangzehua on 2017/7/8.
 */
@Service
public class ModelService {

    private static final Logger logger = LoggerFactory.getLogger(ModelService.class.getName());

    @Autowired
    RestFullTemplate restTemplate;
    /**标志远程服务url**/
    private static final String URLPATH = "service-common/model/";



    public String modelList() throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "getModelList", String.class,"");
        logger.info("ModelService getModelList zuulGateWay result {}", ret);
        return ret;
    }


    public String findModelById(String id) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "findModelById", String.class,id);
        logger.info("ModelService findModelById zuulGateWay result {}", ret);
        return ret;
    }

    public String delModel(String id) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "delModel", String.class,id);
        logger.info("ModelService delModel zuulGateWay result {}", ret);
        return ret;
    }


    public String updateModel(ModeModel modeModel) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "updateModel", String.class,modeModel);
        logger.info("ModelService updateModel zuulGateWay result {}", ret);
        return ret;
    }

    public String insertModel(ModeModel modeModel) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "insertModel", String.class,modeModel);
        logger.info("ModelService insertModel zuulGateWay result {}", ret);
        return ret;
    }

    public String updateParameter(ModeBlockModel modeBlockModel) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "updateBlock", String.class,modeBlockModel);
        logger.info("ModelService updateBlock zuulGateWay result {}", ret);
        return ret;
    }





    public String findModeBlockModelByMid(String mid) throws Exception{
        System.out.println("发送");
        String ret = restTemplate.postForObject(URLPATH + "findModeBlockModelByMid", String.class,mid);
        logger.info("ModelService findModeBlockModelByMid zuulGateWay result {}", ret);
        return ret;
    }




}
